<?php
/**
 * 新增到个人用户
 * @author xulei
 * @since v1.0
 * @modify 2014.9.25
 * @copyright 深圳亿游
 */
require_once(LIB_PATH.'controller/root.con.php');

class yiyouCon extends rootCon
{
    public function printAction(){
        print_r($_FILES);
        print_r($_POST);
    }


    public function loginAction() {
        usleep(300);
        $uid = r_int('uid');
        if(!$uid OR $uid>3000) $uid=1;
        mylogin::login($uid);
        $this->j(0, '成功',['uid'=>$uid]);
    }

    public function logoutAction() {
        usleep(300);
        mylogin::logout();
        $this->j(0, '成功',$_COOKIE);
    }

    public function testAction(){
       print_r(join(',',[-1,0]));
    }
    public function popAction(){
        var_dump(myredis::mypop("msg"));
        var_dump(myredis::mypop("msg"));
        var_dump(myredis::mypop("msg"));
        var_dump(myredis::mypop("msg"));
        var_dump(myredis::mypop("msg"));
        var_dump(myredis::mypop("msg"));
        echo time();
    }

    public function templateAction(){
        myxiaochengxu::addTemplateKeyword("测试咨询1");
        myxiaochengxu::addTemplateKeyword("测试咨询2");
        myxiaochengxu::addTemplateKeyword("测试咨询3");
        myxiaochengxu::addTemplateKeyword("测试咨询4");
        $uid = r('uid');
        if($uid>2000){
            $uid = 20;
        }

        $user = new User();
        $user->find($uid);

        $toUid = 28;
        $errorCode = myxiaochengxu::sendTemplateMsg($user->openId,TEMPLATE_ZIXUN,"/pages/chat/chat?uid=".$toUid);
        if($errorCode) print_r(myxiaochengxu::getErrorInfo());

    }


}

